Skip to content

cmd/anubis: allow setting key bytes in flag/envvar#97

Merged
Xe merged 4 commits intomainfrom
Xe/key-bytes-in-flag
Mar 25, 2025
Merged

cmd/anubis: allow setting key bytes in flag/envvar#97
Xe merged 4 commits intomainfrom
Xe/key-bytes-in-flag

Conversation

@Xe
Copy link
Copy Markdown
Contributor

@Xe Xe commented Mar 23, 2025

Docs are updated to generate a random key on load and when people press the recycle button.

Closes #70
Closes #32

Checklist:

  • Added a description of the changes to the [Unreleased] section of docs/docs/CHANGELOG.md
  • Tested this at least manually

@Xe Xe requested a review from Copilot March 23, 2025 23:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enables setting ed25519 signing keys via a flag or environment variable while updating documentation and deployment configuration. Key changes include:

  • Adding a React component that generates and displays a random key with a refresh button.
  • Introducing a new flag (and associated logic) in the Go code to load or generate ed25519 keys.
  • Updating the CHANGELOG and deployment manifest with the corresponding new functionality and image tag.

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
docs/src/components/RandomKey/index.tsx Added a component to generate and refresh a random signing key.
docs/docs/CHANGELOG.md Updated the changelog to include details about the new key setting option.
cmd/anubis/main.go Integrated key loading/generation logic with flag support and error handling.
lib/anubis.go Updated the New function to incorporate optional ed25519 key usage.
docs/manifest/deployment.yaml Changed the image tag from "latest" to "main".
Files not reviewed (1)
  • docs/docs/admin/installation.mdx: Language not supported

Comment thread docs/src/components/RandomKey/index.tsx Outdated
Comment thread cmd/anubis/main.go Outdated
@Xe Xe requested a review from Copilot March 23, 2025 23:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enables setting the ED25519 private key via a flag or environment variable, while updating both key generation logic and documentation accordingly.

  • Added a React component for displaying and regenerating a random key in the docs.
  • Introduced a new flag (and corresponding environment variable) to allow specifying the ED25519 private key in hex format and updated key handling in both cmd and lib.
  • Updated the CHANGELOG and deployment manifest to reflect these changes.

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
docs/src/components/RandomKey/index.tsx Added a component that generates and displays a random key with a refresh button.
cmd/anubis/main.go Added flag handling for an ED25519 private key in hex and incorporated key conversion logic with appropriate logging for key generation.
docs/docs/CHANGELOG.md Documented the new flag functionality and key handling behavior.
lib/anubis.go Refactored key generation to use an optional provided private key via options.
docs/manifest/deployment.yaml Updated the image tag reference from latest to main.
Files not reviewed (1)
  • docs/docs/admin/installation.mdx: Language not supported
Comments suppressed due to low confidence (2)

docs/src/components/RandomKey/index.tsx:12

  • [nitpick] Consider using the primitive type 'string' instead of 'String' for consistency with TypeScript best practices.
export const genRandomKey = (): String => {

docs/src/components/RandomKey/index.tsx:22

  • [nitpick] Consider using 'string' instead of 'String' in the useState generic type to avoid unintended behavior with boxed type objects.
const [key, setKey] = useState<String>(genRandomKey());

Comment thread cmd/anubis/main.go Outdated
Copy link
Copy Markdown
Contributor

@soopyc soopyc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor docs improvements

Comment thread docs/docs/admin/installation.mdx Outdated
Copy link
Copy Markdown
Contributor

@ryanccn ryanccn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not exactly sure why the refresh button is currently implemented in this roundabout fashion, but I feel like using useCallback (or even just a plain function) would be a more efficient way of updating the random key.

Comment thread docs/src/components/RandomKey/index.tsx Outdated
Comment thread docs/src/components/RandomKey/index.tsx Outdated
Comment thread docs/src/components/RandomKey/index.tsx Outdated
Xe and others added 4 commits March 25, 2025 16:58
Docs are updated to generate a random key on load and when people press
the recycle button.

Signed-off-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Xe Iaso <me@xeiaso.net>
Co-authored-by: Ryan Cao <70191398+ryanccn@users.noreply.github.com>
Signed-off-by: Xe Iaso <me@xeiaso.net>
@Xe Xe force-pushed the Xe/key-bytes-in-flag branch from e43e487 to 2e080d2 Compare March 25, 2025 20:59
@Xe Xe merged commit 4155719 into main Mar 25, 2025
2 checks passed
JasonLovesDoggo pushed a commit to JasonLovesDoggo/anubis that referenced this pull request Jun 17, 2025
* cmd/anubis: allow setting key bytes in flag/envvar

Docs are updated to generate a random key on load and when people press
the recycle button.

Signed-off-by: Xe Iaso <me@xeiaso.net>

* review feedback fixups

Signed-off-by: Xe Iaso <me@xeiaso.net>

* Update cmd/anubis/main.go

Signed-off-by: Xe Iaso <me@xeiaso.net>

* Apply suggestions from code review

Co-authored-by: Ryan Cao <70191398+ryanccn@users.noreply.github.com>
Signed-off-by: Xe Iaso <me@xeiaso.net>

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>
Co-authored-by: Ryan Cao <70191398+ryanccn@users.noreply.github.com>
@Xe Xe deleted the Xe/key-bytes-in-flag branch July 2, 2025 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Persist Anubis ed25519 key to allow for multi-instance operation

5 participants